package logic

import (
	"context"
	"goods_srv/model/redis"

	"goods_srv/goods"
	"goods_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetGoodsOfLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetGoodsOfLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGoodsOfLogic {
	return &GetGoodsOfLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetGoodsOfLogic) GetGoodsOf(in *goods.GetGoodsOfRequest) (*goods.GetGoodsOfResponse, error) {
	status := redis.GetGoodsStatus(int64(int(in.GoodsId)))
	return &goods.GetGoodsOfResponse{
		Status: int64(status),
	}, nil
}
